﻿using NPOI.OpenXmlFormats.Dml.Chart;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TEngine;
using UnityEngine;

namespace GameLogic
{
    public class WeaponView:MonoBehaviour
    {
        SpriteRenderer m_SpriteRenderer;
        public void Awake()
        {
            m_SpriteRenderer = GetComponent<SpriteRenderer>();
            if(!m_SpriteRenderer)
                m_SpriteRenderer = gameObject.AddComponent<SpriteRenderer>();
        }
        public void Init(WeaponData data)
        {
            try
            {
                m_SpriteRenderer.sprite = GameModule.Resource.LoadAsset<Sprite>(data.Cfg.SpritePath);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
    }
}
